<?php
/**
 * Created by JetBrains PhpStorm.
 * User: JKen22078
 * Date: 7/22/13
 * Time: 10:47 PM
 * To change this template use File | Settings | File Templates.
 */

?>
<head>
  <script type="text/javascript" src="<?php echo base_url();?>public/js/jquery-2.0.3.js"></script>
</base>
<?php echo validation_errors(); ?>
<?php //var_dump($parent);?>
<?php echo form_open_multipart('upload/do_upload'); ?>
<!--upload file-->
<script style="text/javascript">
  $(document).ready(function(){
    $("p").click(function(){
      $(this).hide();
    });
  });
</script>

<input type="file" name="file" size="20" />
<!--//chọn phong - get data phong từ tbl_office-->
<select name="slcat" onchange="morechild(options[selectedIndex].value)" id="parent">
  <?php
  $i = 0;
  foreach($parent as $item_parent){
    $i++;
    if($i == 1){
      echo '<option value="'.$item_parent->idCat.'" selected="selected">'.$item_parent->nameCat.'</option>';
    }else{
      echo '<option value="'.$item_parent->idCat.'" >'.$item_parent->nameCat.'</option>';
    }

  }
  ?>
</select>
  <div id ="child" name ="slchild">
    <select name="child" id="slchild">

    </select>
  </div>
  <!--chon loai tai lieu-->

<div><input type="submit" value="OK" /></div>
<?php echo form_close();?>

<script style="text/javascript">

    var id = $('#parent').val();
    morechild(id);
    //console.log(id);

  function morechild(ID){
//    console.log(ID);
    $.ajax({
      type:'POST',
      timeout: 1500,
      url : 'http://localhost:8080/CIfw/index.php/upload/getInfoAjax/'+ID,
      success:function (data){
          $("#slchild").html(data);
      }
    }) // end of ajax request
  }
</script>
